#include "StdAfx.h"
#include "AGAimIkOverride.h"
#include "ICryAnimation.h"
#include "AnimatedCharacter.h"

CAGAimIkOverride::CAGAimIkOverride()
{
}

CAGAimIkOverride::~CAGAimIkOverride()
{
}

void CAGAimIkOverride::EnterState( SAnimationStateData& data, bool dueToRollback )
{
}

EHasEnteredState CAGAimIkOverride::HasEnteredState( SAnimationStateData& data )
{
	return eHES_Instant;
}

void CAGAimIkOverride::EnteredState( SAnimationStateData& data )
{
	if (!data.pEntity || !data.pAnimatedCharacter)
		return;

	data.pAnimatedCharacter->AllowAimIk( false );
}

bool CAGAimIkOverride::CanLeaveState( SAnimationStateData& data )
{
	return true;
}

void CAGAimIkOverride::LeaveState( SAnimationStateData& data )
{
	if (!data.pEntity || !data.pAnimatedCharacter)
		return;

	data.pAnimatedCharacter->AllowAimIk( true );
}

void CAGAimIkOverride::LeftState( SAnimationStateData& data, bool wasEntered )
{
}

void CAGAimIkOverride::Update( SAnimationStateData& data )
{
	CRY_ASSERT(false);
}

void CAGAimIkOverride::GetCompletionTimes(SAnimationStateData& data, CTimeValue start, CTimeValue& hard, CTimeValue& sticky)
{
	hard = sticky = 0.0f;
}

const IAnimationStateNodeFactory::Params * CAGAimIkOverride::GetParameters()
{
	static const Params params[] = 
	{
		{0}
	};
	return params;
}

IAnimationStateNodeFactory * CAGAimIkOverride::GetFactory()
{
	return this;
}

void CAGAimIkOverride::DebugDraw( SAnimationStateData& data, IRenderer * pRenderer, int x, int& y, int yIncrement )
{
/*
	float white[] = {1,1,1,1};
	pRenderer->Draw2dLabel( x, y, 1, white, false, "anim: %s", m_name.c_str() );
	y += yIncrement;
*/
}

bool CAGAimIkOverride::Init(const XmlNodeRef& node, IAnimationGraphPtr pGraph)
{
	return true;
}

void CAGAimIkOverride::Release()
{
	delete this;
}

IAnimationStateNode * CAGAimIkOverride::Create()
{
	return this;
}

const char * CAGAimIkOverride::GetCategory()
{
	return "AimIk";
}

const char * CAGAimIkOverride::GetName()
{
	return "AimIk";
}

void CAGAimIkOverride::Paused( SAnimationStateData& data, bool paused, float fOverrideTransTime /*= -1.0f*/ )
{
	if (!paused)
	{
		EnteredState(data);
	}
}